package com.kefu.chat.vo;

import javax.validation.constraints.Size;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.kefu.chat.model.ChatReply;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractInsertVo;

import cn.hutool.core.util.IdUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "chat_reply")
public class ChatReplyInsertVo extends AbstractInsertVo<ChatReply> {
    @Size(max = 32)
    @ApiModelProperty(name = "parentId", value = "上级id,没有上级传0")
    private String parentId;
    @ApiModelProperty(name = "name", value = "内容")
    private String name;
    @ApiModelProperty(name = "keyword", value = "关键词")
    private String keyword;
    @ApiModelProperty(name = "weight", value = "序号", hidden = true)
    private Integer weight;
    @ApiModelProperty(name = "type", value = "类型：0公共，1自己")
    private Integer type;

    @Override
    public ChatReply convert() {
        ChatReply info = BeanUtil.toBean(this, ChatReply.class);
        info.setId(IdUtil.simpleUUID());
        info.setCreateTime(DateUtil.current());
        info.setUpdateTime(DateUtil.current());
        info.setTenantId(KefuContext.getTid());
        info.setAdminId(KefuContext.getUid());
        return info;
    }

}